package com.tangfuzhong.proxy;



public class TestProxy2 {
    public static void main(String[] args) {

        MyInterceptor transactionInterceptor = new TransactionInterceptor();
        MyInterceptor logInterceptor = new LogInterceptor();
        MyInterceptorChain interceptorChain = new MyInterceptorChain();
        interceptorChain.addInterceptor(transactionInterceptor);
        interceptorChain.addInterceptor(logInterceptor);

        MyProxy.HelloService target = new MyProxy.HelloServiceImpl();
        target = (MyProxy.HelloService) interceptorChain.pluginAll(target);
        target.sayHello();
    }
}
